package com.ymatou.iapi.usersafe.testcase;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
import java.util.Random;

import org.apache.http.client.ClientProtocolException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.login.parameter.LoginAuthBean;
import com.ymatou.iapi.login.parameter.ThirdpartyLoginBean;
import com.ymatou.iapi.login.service.LoginAuthCall;
import com.ymatou.iapi.trading.operate.parameter.PlaceOrderService;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymatou.iapi.usersafe.parameter.VerifyBean;
import com.ymatou.iapi.usersafe.service.VerifyCall;
import com.ymatou.iapi.userservice.parameter.AddressRequestDtoBean;
import com.ymt.base.YmatouEasyCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.AccountCallService;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.NameList;
import com.ymttest.database.mongo.ULC201406Bean;
import com.ymttest.database.mongo.ULC201406Wapper;
import com.ymttest.database.mongo.YmatouBlacklistUserWapper;
import com.ymttest.database.sqlwapper.UserSafeWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.ECode;

/**
 * 验证用户安全 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_VerifyRiskStrategy {
	private static VerifyBean verifyBean;
	private static VerifyCall verifyCall;
	private static UserSafeWapper userSafeWapper;
	int ret = 5;

	@BeforeClass
	public static void setUp() throws Exception {
		Logger.createResultFile("新版本用户风控RiskStrategy");
		userSafeWapper = new UserSafeWapper();
	}

	@Before
	public void caseUp() throws InterruptedException, ClientProtocolException, IOException {
		verifyBean = new VerifyBean();
		verifyCall = new VerifyCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(verifyCall.getOpurl() + ":RiskStrategy");
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	/**
	 * 初始化数据库配置 DefaultSafeVerifyStrategy 默认是2开启,不受status影响
	 * 
	 * @param status
	 *            风控状态 0 关闭 2开启
	 * @throws InterruptedException
	 * @throws ClientProtocolException
	 * @throws IOException
	 */
	public void initConfig(int status) throws InterruptedException, ClientProtocolException, IOException {
		Logger.comment("初始化配置status:" + status);
		// ip注册风控
		userSafeWapper.updateRiskStrategyStatus(1, "IP");
		// 设备号注册风控
		userSafeWapper.updateRiskStrategyStatus(1, "device");
		// ip设备号注册风控
		userSafeWapper.updateRiskStrategyStatus(1, "IP_device");
		// 以上3个为注册策略不在VerifyRiskStrategy策略范围内,不修改状态

		// 默认风控开关 dimension_strategy:checkOtherUserTypeLoginAuth=true
		userSafeWapper.updateRiskStrategyStatus(status, "DefaultSafeVerifyStrategy");
		// 买家设备号黑名单 dimension_strategy:deviceIdAllowNull=true
		userSafeWapper.updateRiskStrategyStatus(status, "BuyerDeviceIdBlacklistVerifyStrategy");
		// 买家ip区域认证(买家是否在此区域认证过)
		userSafeWapper.updateRiskStrategyStatus(status, "BuyerIpAreaVerifyStrategy");
		// 买家ip黑名单列表(该ip是否在黑名单中) dimension_strategy:
		// loginSuccessLimit=5
		// loginSuccessLimitMinutes=2
		// loginFailLimit=3
		// loginFailLimitMinutes=1
		// lockExpiredMinutes=10
		userSafeWapper.updateRiskStrategyStatus(status, "BuyerIpBlacklistVerifyStrategy");
		// 买家登入次数黑名单 dimension_strategy:
		// rangMinutes=1
		// countLimit=5
		userSafeWapper.updateRiskStrategyStatus(status, "BuyerLoginCountVerifyStrategy");
		// 买家登入密码错误次数 dimension_strategy:
		// rangMinutes=1
		// countLimit=5
		userSafeWapper.updateRiskStrategyStatus(status, "BuyerLoginPasswordFailTimesVerifyStrategy");
		// 买家常用设备号认证 dimension_strategy:deviceIdAllowNull=true
		userSafeWapper.updateRiskStrategyStatus(status, "BuyerOftenDeviceIdVerifyStrategy");
		// 买家token认证
		userSafeWapper.updateRiskStrategyStatus(status, "BuyerTokenVerifyStrategy");
		// 买手设备号黑名单 dimension_strategy:deviceIdAllowNull=true
		userSafeWapper.updateRiskStrategyStatus(status, "SellerDeviceIdBlacklistVerifyStrategy");
		// 买手ip区域认证
		userSafeWapper.updateRiskStrategyStatus(status, "SellerIpAreaVerifyStrategy");
		// 买手ip黑名单 dimension_strategy:
		// loginSuccessLimit=5
		// loginSuccessLimitMinutes=2
		// loginFailLimit=3
		// loginFailLimitMinutes=1
		// lockExpiredMinutes=10
		userSafeWapper.updateRiskStrategyStatus(status, "SellerIpBlacklistVerifyStrategy");
		// 买手登入次数 dimension_strategy:
		// rangMinutes=1
		// countLimit=5
		userSafeWapper.updateRiskStrategyStatus(status, "SellerLoginCountVerifyStrategy");
		// 买手登入密码错误次数 dimension_strategy:
		// rangMinutes=1
		// countLimit=5
		userSafeWapper.updateRiskStrategyStatus(status, "SellerLoginPasswordFailTimesVerifyStrategy");
		// 买手常用设备号验证 dimension_strategy:deviceIdAllowNull=true
		userSafeWapper.updateRiskStrategyStatus(status, "SellerOftenDeviceIdVerifyStrategy");
		// 买手token验证
		userSafeWapper.updateRiskStrategyStatus(status, "SellerTokenVerifyStrategy");
		// 买手登入id黑名单
		userSafeWapper.updateRiskStrategyStatus(status, "SellerLoginIdBlackListVerifyStrategy");
		// 买家登入id黑名单
		userSafeWapper.updateRiskStrategyStatus(status, "BuyerLoginIdBlackListVerifyStrategy");

		// BuyerAppSourceLoginVerifyStrategy 120：买家登录来源时间限制

		userSafeWapper.updateRiskStrategyStatus(status, "BuyerAppSourceLoginVerifyStrategy");
	}

	private VerifyBean initSellerVerify(VerifyBean vb, UserRegisterInfoRequestDtoBean urb, Integer uid) {
		vb.setAppId("sellerapp");
		vb.setAppSource("sellerapp");
		vb.setClientIp(urb.getClientIp());
		vb.setDeviceId(urb.getDeviceId());
		vb.setLoginId(urb.getLoginId());
		vb.setUserId(uid);
		return vb;
	}

	public VerifyBean initVerify(VerifyBean vb, UserRegisterInfoRequestDtoBean urb, Integer uid) {
		vb.setAppId("app");
		vb.setAppSource("app");
		vb.setClientIp(urb.getClientIp());
		vb.setDeviceId(urb.getDeviceId());
		vb.setLoginId(urb.getLoginId());
		vb.setUserId(uid);
		return vb;
	}

	/**
	 * @see #insertNameList(int, int, int, String, Date, Date)
	 * @param ListType
	 * @param NameType
	 * @param ScopeType
	 * @param name
	 */
	private void insertNameList(int ListType, int NameType, int ScopeType, String name) {
		UserSafeWapper wapper = new UserSafeWapper();
		NameList namelist = new NameList();
		namelist.setCreateTime(YMTDateUtil.getDate());
		namelist.setStartTime(YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(-1, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING));
		namelist.setEndTime(YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(1, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING));
		namelist.setLastUpdateTime(YMTDateUtil.getDate());
		namelist.setCreator("autotest");
		namelist.setName(name);
		namelist.setNameType(NameType);
		namelist.setScopeType(ScopeType);
		namelist.setListType(ListType);
		wapper.insertNameList(namelist);
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_001() {
		Logger.start(true, "买家用户app验证用户安全,认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(2);
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			LoginAuthCall login = JUserCallService.login(urb.getLoginId(), urb.getPas(), "sellerapp", urb.getClientIp(), urb.getDeviceId());
			verifyBean = initVerify(verifyBean, urb, uid);
			Logger.verifyEquals("true", login.getString("Success"), "验证登入成功");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_002() {
		Logger.start(true, "买手商家sellerapp验证用户安全,认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(2);
			userSafeWapper.updateRiskStrategyStatus(0, "DefaultSafeVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			LoginAuthCall login = JUserCallService.login(urb.getLoginId(), urb.getPas(), "sellerapp", urb.getClientIp(), urb.getDeviceId());
			Logger.verifyEquals("true", login.getString("Success"), "验证登入成功");
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_003() {
		Logger.start(true, "DefaultSafeVerifyStrategy关闭,认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(2);
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			JUserCallService.login(urb.getLoginId(), urb.getPas(), "sellerapp", urb.getClientIp(), urb.getDeviceId());
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_004() {
		Logger.start(true, "BuyerDeviceIdBlacklistVerifyStrategy开启status2,买家设备号黑名单风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerDeviceIdBlacklistVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getDeviceId();
			insertNameList(2, 4, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(162, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("设备号黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_005() {
		Logger.start(true, "BuyerDeviceIdBlacklistVerifyStrategy关闭status0,买家设备号黑名单认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getDeviceId();
			insertNameList(2, 4, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_006() {
		Logger.start(true, "BuyerIpAreaVerifyStrategy开启status2,买家ip区域风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(10) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setClientIp("136.1.1.1");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(155, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("常用Ip区域不存在或未认证，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_007() {
		Logger.start(true, "BuyerIpAreaVerifyStrategy开启status2,ip为空,,买家ip区域风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(10) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setClientIp("");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4200, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("请求IP为空或格式错误", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_008() {
		Logger.start(true, "BuyerIpAreaVerifyStrategy开启status2,ip格式不正确,,买家ip区域风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(10) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setClientIp("aa");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4200, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("请求IP为空或格式错误", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_009() {
		Logger.start(true, "BuyerIpAreaVerifyStrategy关闭status0,买家ip区域认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "BuyerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(10) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setClientIp("136.1.1.1");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_010() {
		Logger.start(true, "BuyerIpBlacklistVerifyStrategy开启status2,买家ip黑名单列表风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerIpBlacklistVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getClientIp();
			insertNameList(2, 3, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_011() {
		Logger.start(true, "BuyerIpBlacklistVerifyStrategy关闭status0,买家ip黑名单列表认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "BuyerIpBlacklistVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getClientIp();
			insertNameList(2, 3, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_012() {
		Logger.start(true, "BuyerLoginCountVerifyStrategy开启status2,买家登入次数黑名单风控");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerLoginCountVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			JUserCallService.login(urb.getLoginId(), "123456a", "app", urb.getClientIp(), urb.getDeviceId());
			int i = 0;
			while (i <= 10) {
				JUserCallService.login(urb.getLoginId(), "111111", "app", urb.getClientIp(), urb.getDeviceId());
				i++;
			}

			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(1700, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");
			Logger.verifyEquals("登录ID超过登录限制，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_013() {
		Logger.start(true, "BuyerLoginCountVerifyStrategy关闭status0,买家登入次数黑名单认证pass");
		try {
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "BuyerLoginCountVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			JUserCallService.login(urb.getLoginId(), "123456a", "app", urb.getClientIp(), urb.getDeviceId());
			int i = 0;
			while (i <= 10) {
				JUserCallService.login(urb.getLoginId(), "123456a", "app", urb.getClientIp(), urb.getDeviceId());
				i++;
			}

			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_014() {
		Logger.start(true, "BuyerLoginPasswordFailTimesVerifyStrategy开启status2,买家登入密码错误次数风控");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerLoginPasswordFailTimesVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			JUserCallService.login(urb.getLoginId(), "123456a", "app", urb.getClientIp(), urb.getDeviceId());
			int i = 0;
			while (i <= 10) {
				JUserCallService.login(urb.getLoginId(), "111111", "app", urb.getClientIp(), urb.getDeviceId());
				i++;
			}

			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(130, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");
			Logger.verifyEquals("登录密码次数超限，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_015() {
		Logger.start(true, "BuyerLoginPasswordFailTimesVerifyStrategy关闭status0,买家登入密码错误次数认证pass");
		try {
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "BuyerLoginPasswordFailTimesVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			JUserCallService.login(urb.getLoginId(), "123456a", "app", urb.getClientIp(), urb.getDeviceId());
			int i = 0;
			while (i <= 10) {
				JUserCallService.login(urb.getLoginId(), "111111", "app", urb.getClientIp(), urb.getDeviceId());
				i++;
			}

			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_016() {
		Logger.start(true, "BuyerOftenDeviceIdVerifyStrategy开启status2,买家常用设备号风控JIRACONN-13509");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerOftenDeviceIdVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String did = TestDataManager.getRandomUUID().toString();
			LoginAuthBean loginBean = JUserCallService.initLoginAuthBean(urb);
			loginBean.setLoginId(urb.getLoginId());
			loginBean.setDeviceId(did);
			loginBean.setClientIp(urb.getClientIp());
			JUserCallService.loginAuth(loginBean);

			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setDeviceId(did);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			// Logger.verifyEquals(175, verifyCall.getCode(), "验证code");
			// Logger.verifyEquals("设备号不存在或未认证，执行身份认证",
			// verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_017() {
		Logger.start(true, "BuyerOftenDeviceIdVerifyStrategy关闭status0,买家常用设备号认证pass");
		try {
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "BuyerOftenDeviceIdVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setDeviceId(TestDataManager.getRandomUUID().toString());
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_018() {
		Logger.start(true, "BuyerTokenVerifyStrategy开启status2,买家token认证风控（最后登入90天）");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerTokenVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(240) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer userId = uc.getUserid();
			Thread.sleep(2000);
			Logger.comment("如果认证数据库中不存在该IP的Token记录，则插入token数据，并将token的最后更新时间更改为90天以前");
			Map<String, Object> ipAuth = userSafeWapper.getIPAuthByUserIdAndArea(userId, "China", "Guangdong", "*");
			String dateTime = YMTDateUtil.getBeforeOrNextDay(-100);
			if (ipAuth == null) {
				userSafeWapper.insertIPTokenAuthHistory(userId, "China", "Guangdong", "*", dateTime, dateTime);
				userSafeWapper.insertUserIpAuth(userId, "China", "Guangdong", "*", 200, dateTime, dateTime, "mainsite", dateTime, dateTime);
			} else {
				userSafeWapper.updateTokenUpdateTime(userId, "China", "Guangdong", "*", dateTime);
			}
			Thread.sleep(3000);
			verifyBean = initVerify(verifyBean, urb, userId);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(161, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("最后一次TOKENIP区域", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_019() {
		Logger.start(true, "BuyerTokenVerifyStrategy开启status2,ip为空,买家token认证风控");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerTokenVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer userId = uc.getUserid();
			verifyBean = initVerify(verifyBean, urb, userId);
			verifyBean.setClientIp("");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4200, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("请求IP为空或格式错误", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_020() {
		Logger.start(true, "BuyerTokenVerifyStrategy开启status2,ip格式不正确,买家token认证风控");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerTokenVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer userId = uc.getUserid();
			verifyBean = initVerify(verifyBean, urb, userId);
			verifyBean.setClientIp("aaa");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4200, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("请求IP为空或格式错误", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_021() {
		Logger.start(true, "BuyerTokenVerifyStrategy关闭status0,买家token认证pass");
		try {
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "BuyerTokenVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer userId = uc.getUserid();
			verifyBean = initVerify(verifyBean, urb, userId);
			verifyBean.setClientIp("");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_022() {
		Logger.start(true, "SellerDeviceIdBlacklistVerifyStrategy开启status2,买手设备号黑名单认证风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerDeviceIdBlacklistVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getDeviceId();
			insertNameList(2, 4, 0, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(162, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("设备号黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_023() {
		Logger.start(true, "SellerDeviceIdBlacklistVerifyStrategy关闭status0,买手设备号黑名单认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "SellerDeviceIdBlacklistVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getDeviceId();
			insertNameList(2, 4, 0, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_024() {
		Logger.start(true, "SellerIpAreaVerifyStrategy开启status2,买手ip区域认证风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyBean.setClientIp("127.1.1.1");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(155, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("常用Ip区域不存在或未认证，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_025() {
		Logger.start(true, "SellerIpAreaVerifyStrategy开启status2,ip为空,买手ip区域风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyBean.setClientIp("");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("请求IP为空或格式错误", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_026() {
		Logger.start(true, "SellerIpAreaVerifyStrategy开启status2,ip格式不正确,买手ip区域风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyBean.setClientIp("aa");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("请求IP为空或格式错误", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_027() {
		Logger.start(true, "SellerIpAreaVerifyStrategy开启status2,ip为内网,买手ip区域风控");
		try {
			// 这个case待确认
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerIpAreaVerifyStrategy");
			// 设置禁止段 内网
			userSafeWapper.updateRiskStrategy("denyLoginIpArea=lan", "SellerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("192.168.0.1");
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(101, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("内网IP身份认证，执行", verifyCall.getAuthMessage(), "验证AuthMessage");
			userSafeWapper.updateRiskStrategy("", "SellerIpAreaVerifyStrategy");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_028() {
		Logger.start(true, "SellerIpAreaVerifyStrategy关闭status0,买手ip区域认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "SellerIpAreaVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyBean.setClientIp("127.1.1.1");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_029() {
		Logger.start(true, "SellerIpBlacklistVerifyStrategy开启status2,买手ip黑名单认证风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerIpBlacklistVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getClientIp();
			insertNameList(2, 3, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_030() {
		Logger.start(true, "SellerIpBlacklistVerifyStrategy关闭status0,买手ip黑名单认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "SellerIpBlacklistVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getClientIp();
			insertNameList(2, 3, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_031() {
		Logger.start(true, "SellerLoginCountVerifyStrategy开启status2,买手登入次数认证风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerLoginCountVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			int i = 0;
			while (i <= 11) {
				JUserCallService.login(urb.getLoginId(), "123456a", "sellerapp", urb.getClientIp(), urb.getDeviceId());
				i++;
			}
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(1700, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("登录ID超过登录限制，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_032() {
		Logger.start(true, "SellerLoginCountVerifyStrategy关闭status0,买手登入次数认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "SellerLoginCountVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			int i = 0;
			while (i <= 11) {
				JUserCallService.login(urb.getLoginId(), "123456a", "sellerapp", urb.getClientIp(), urb.getDeviceId());
				i++;
			}
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_033() {
		Logger.start(true, "SellerLoginPasswordFailTimesVerifyStrategy开启status2,买手登入密码错误次数认证风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerLoginPasswordFailTimesVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			int i = 0;
			while (i <= 11) {
				JUserCallService.login(urb.getLoginId(), "111111", "sellerapp", urb.getClientIp(), urb.getDeviceId());
				i++;
			}
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(130, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("登录密码次数超限，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_034() {
		Logger.start(true, "SellerLoginPasswordFailTimesVerifyStrategy关闭status0,买手登入密码错误次数认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "SellerLoginPasswordFailTimesVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			int i = 0;
			while (i <= 11) {
				JUserCallService.login(urb.getLoginId(), "111111", "sellerapp", urb.getClientIp(), urb.getDeviceId());
				i++;
			}
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_035() {
		Logger.start(true, "SellerOftenDeviceIdVerifyStrategy开启status2,买手常用设备号验证认证风控");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerOftenDeviceIdVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyBean.setDeviceId(TestDataManager.getRandomUUID().toString());
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(175, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("设备号不存在或未认证，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_036() {
		Logger.start(true, "SellerOftenDeviceIdVerifyStrategy关闭status0,买手常用设备号验证认证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "SellerOftenDeviceIdVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyBean.setDeviceId(TestDataManager.getRandomUUID().toString());
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_037() {
		Logger.start(true, "SellerTokenVerifyStrategy开启status2,买手token验证认证风控（最后登入90天）");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerTokenVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(240) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer userId = uc.getUserid();
			Thread.sleep(2000);
			Logger.comment("如果认证数据库中不存在该IP的Token记录，则插入token数据，并将token的最后更新时间更改为90天以前");
			Map<String, Object> ipAuth = userSafeWapper.getIPAuthByUserIdAndArea(userId, "China", "Guangdong", "*");
			String dateTime = YMTDateUtil.getBeforeOrNextDay(-100);
			if (ipAuth == null) {
				userSafeWapper.insertIPTokenAuthHistory(userId, "China", "Guangdong", "*", dateTime, dateTime);
				userSafeWapper.insertUserIpAuth(userId, "China", "Guangdong", "*", 200, dateTime, dateTime, "mainsite", dateTime, dateTime);
			} else {
				userSafeWapper.updateTokenUpdateTime(userId, "China", "Guangdong", "*", dateTime);
			}
			Thread.sleep(2000);
			verifyBean = initSellerVerify(verifyBean, urb, userId);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(161, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("最后一次TOKENIP区域", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_038() {
		Logger.start(true, "SellerTokenVerifyStrategy开启status2,ip为空,买家token认证风控");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerTokenVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(240) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer userId = uc.getUserid();
			Thread.sleep(2000);
			Logger.comment("如果认证数据库中不存在该IP的Token记录，则插入token数据，并将token的最后更新时间更改为90天以前");
			Map<String, Object> ipAuth = userSafeWapper.getIPAuthByUserIdAndArea(userId, "China", "Guangdong", "*");
			String dateTime = YMTDateUtil.getBeforeOrNextDay(-100);
			if (ipAuth == null) {
				userSafeWapper.insertIPTokenAuthHistory(userId, "China", "Guangdong", "*", dateTime, dateTime);
				userSafeWapper.insertUserIpAuth(userId, "China", "Guangdong", "*", 200, dateTime, dateTime, "mainsite", dateTime, dateTime);
			} else {
				userSafeWapper.updateTokenUpdateTime(userId, "China", "Guangdong", "*", dateTime);
			}
			Thread.sleep(3000);
			verifyBean = initSellerVerify(verifyBean, urb, userId);
			verifyBean.setClientIp("");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4200, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("请求IP为空或格式错误", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_039() {
		Logger.start(true, "SellerTokenVerifyStrategy开启status2,ip格式不正确,买家token认证风控");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "SellerTokenVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(240) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer userId = uc.getUserid();
			Thread.sleep(2000);
			Logger.comment("如果认证数据库中不存在该IP的Token记录，则插入token数据，并将token的最后更新时间更改为90天以前");
			Map<String, Object> ipAuth = userSafeWapper.getIPAuthByUserIdAndArea(userId, "China", "Guangdong", "*");
			String dateTime = YMTDateUtil.getBeforeOrNextDay(-100);
			if (ipAuth == null) {
				userSafeWapper.insertIPTokenAuthHistory(userId, "China", "Guangdong", "*", dateTime, dateTime);
				userSafeWapper.insertUserIpAuth(userId, "China", "Guangdong", "*", 200, dateTime, dateTime, "mainsite", dateTime, dateTime);
			} else {
				userSafeWapper.updateTokenUpdateTime(userId, "China", "Guangdong", "*", dateTime);
			}
			Thread.sleep(3000);
			verifyBean = initSellerVerify(verifyBean, urb, userId);
			verifyBean.setClientIp("aa");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4200, verifyCall.getCode(), "验证code");
			Logger.verifyIsContains("请求IP为空或格式错误", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_040() {
		Logger.start(true, "SellerTokenVerifyStrategy开启status0,买手token验证认证pass");
		try {
			initConfig(1);
			// userSafeWapper.updateRiskStrategyStatus(2,
			// "SellerTokenVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp("1.1.10." + (new Random().nextInt(240) + 1));
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer userId = uc.getUserid();
			Thread.sleep(2000);
			Logger.comment("如果认证数据库中不存在该IP的Token记录，则插入token数据，并将token的最后更新时间更改为90天以前");
			Map<String, Object> ipAuth = userSafeWapper.getIPAuthByUserIdAndArea(userId, "China", "Guangdong", "*");
			String dateTime = YMTDateUtil.getBeforeOrNextDay(-100);
			if (ipAuth == null) {
				userSafeWapper.insertIPTokenAuthHistory(userId, "China", "Guangdong", "*", dateTime, dateTime);
				userSafeWapper.insertUserIpAuth(userId, "China", "Guangdong", "*", 200, dateTime, dateTime, "mainsite", dateTime, dateTime);
			} else {
				userSafeWapper.updateTokenUpdateTime(userId, "China", "Guangdong", "*", dateTime);
			}
			Thread.sleep(2000);
			verifyBean = initSellerVerify(verifyBean, urb, userId);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	// pc等无设备号情况
	public void Tc_VerifyRiskStrategy_041() {
		Logger.start(true, "BuyerDeviceIdBlacklistVerifyStrategy开启status2,设备号为空时通过");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerDeviceIdBlacklistVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getDeviceId();
			insertNameList(2, 4, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setDeviceId("");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	// BuyerAppSourceLoginVerifyStrategy
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_042() {
		Logger.start(false, "mainsite渠道BuyerAppSourceLoginVerifyStrategy开启status2,loginrecord没有记录,此用户最近12月没有下过单不会被风控JIRACONN-13509");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerAppSourceLoginVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			new UserSafeWapper().deleteLoginRecord(uid);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setAppSource("mainsite");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_043() {
		// 现在需要有app登入记录才会风控 没有则不处理
		Logger.start(false, "wap渠道BuyerAppSourceLoginVerifyStrategy开启status2,loginrecord有app登入记录且没有当前渠道记录,且下过单被风控登录来源时间限制JIRACONN-13509");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerAppSourceLoginVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegSource(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			// 添加地址
			AddressRequestDtoBean addressBean = JUserCallService.initAddressBean(uid);
			JUserCallService.AddressRequestDtoCall(addressBean);
			// 设置账户余额
			String aid = AccountCallService.getAccountId(uid);
			AccountCallService.resetAccount(aid, new BigDecimal("1000"), new BigDecimal("100"));
			// 下单
			PlaceOrderService.payOrder(uid);
			Thread.sleep(3000);
			// Thread.sleep(1000);
			// new UserSafeWapper().deleteLoginRecord(uid);
			Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setAppSource("wap");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(120, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("登录来源时间限制", verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_044() {
		Logger.start(true, "app渠道BuyerAppSourceLoginVerifyStrategy开启status2,最近limitDays=60内,不风控,通过");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerAppSourceLoginVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			new UserSafeWapper().deleteLoginRecord(uid);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	// 现在需要有app登入记录才会风控 没有则不处理
	public void Tc_VerifyRiskStrategy_045() {
		Logger.start(false, "mainsite渠道BuyerAppSourceLoginVerifyStrategy开启status2,最近limitDays=365外且下过单,被风控登录来源时间限制JIRACONN-13509");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerAppSourceLoginVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegSource(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			String time = YMTDateUtil.getBeforeOrNextDay(-366);
			String appsource = "mainsite";
			Thread.sleep(1000);
			// userSafeWapper.deleteLoginRecord(uid);
			userSafeWapper.insertLoginRecord(uid, appsource, time);
			// Thread.sleep(1000);

			// 添加地址
			AddressRequestDtoBean addressBean = JUserCallService.initAddressBean(uid);
			JUserCallService.AddressRequestDtoCall(addressBean);
			// 设置账户余额
			String aid = AccountCallService.getAccountId(uid);
			AccountCallService.resetAccount(aid, new BigDecimal("1000"), new BigDecimal("100"));
			// 下单
			PlaceOrderService.payOrder(uid);
			Thread.sleep(3000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setAppSource(appsource);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(120, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("登录来源时间限制", verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_046() {
		Logger.start(false, "mainsite渠道BuyerAppSourceLoginVerifyStrategy开启status2,最近limitDays=60内有记录,不控制");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerAppSourceLoginVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegSource(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			String time = YMTDateUtil.getBeforeOrNextDay(0);
			String appsource = "mainsite";
			Thread.sleep(1000);
			// userSafeWapper.deleteLoginRecord(uid);
			userSafeWapper.insertLoginRecord(uid, appsource, time);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setAppSource(appsource);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals(ECode.AUTH_PASS, verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_047() {
		// 现在需要有app登入记录才会风控 没有则不处理
		Logger.start(false, "mainsite渠道用wap验证BuyerAppSourceLoginVerifyStrategy开启status2,最近limitDays=60内有记录且下过单,控制JIRACONN-13509");
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerAppSourceLoginVerifyStrategy");
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegSource(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			String time = YMTDateUtil.getBeforeOrNextDay(0);
			String appsource = "mainsite";
			Thread.sleep(1000);
			// userSafeWapper.deleteLoginRecord(uid);
			userSafeWapper.insertLoginRecord(uid, appsource, time);
			// Thread.sleep(1000);
			// 添加地址
			AddressRequestDtoBean addressBean = JUserCallService.initAddressBean(uid);
			JUserCallService.AddressRequestDtoCall(addressBean);
			// 设置账户余额
			String aid = AccountCallService.getAccountId(uid);
			AccountCallService.resetAccount(aid, new BigDecimal("1000"), new BigDecimal("100"));
			// 下单
			PlaceOrderService.payOrder(uid);
			Thread.sleep(3000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setAppSource("wap");
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(120, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("登录来源时间限制", verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_048() {
		Logger.start(true, "BuyerOftenDeviceIdVerifyStrategy开启status2最近一年有过购买记录,买家常用设备号风控JIRACONN-13509");
		try {
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerOftenDeviceIdVerifyStrategy");
			// 注册用户
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			// 添加地址
			AddressRequestDtoBean addressBean = JUserCallService.initAddressBean(uid);
			JUserCallService.AddressRequestDtoCall(addressBean);
			// 设置账户余额
			String aid = AccountCallService.getAccountId(uid);
			AccountCallService.resetAccount(aid, new BigDecimal("1000"), new BigDecimal("100"));
			// 下单
			PlaceOrderService.payOrder(uid);
			Thread.sleep(3000);
			String did = TestDataManager.getRandomUUID().toString();
			LoginAuthBean loginBean = JUserCallService.initLoginAuthBean(urb);
			loginBean.setLoginId(urb.getLoginId());
			loginBean.setDeviceId(did);
			loginBean.setClientIp(urb.getClientIp());
			JUserCallService.loginAuth(loginBean);

			Thread.sleep(3000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyBean.setDeviceId(did);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(175, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("设备号不存在或未认证，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_049() {
		Logger.start(true, "BuyerIpBlacklistVerifyStrategy开启status2多级规则,密码错误触发买家ip黑名单列表风控JIRACONN-13509");
		// sit
		// loginSuccessConfig=1-10-1,2-16-2
		// loginFailConfig=1-5-1,2-8-2
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerIpBlacklistVerifyStrategy");
			String ip = TestDataManager.getRandomIp();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp(ip);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			// 执行11次 触发第一个风控
			for (int i = 0; i <= 5; i++) {
				urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
				urb.setClientIp(ip);
				uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
				uid = uc.getUserid();

				LoginAuthBean loginBean = JUserCallService.initLoginAuthBean(urb);
				loginBean.setLoginId(urb.getLoginId());
				loginBean.setDeviceId(urb.getDeviceId());
				loginBean.setClientIp(urb.getClientIp());
				// 密码正确和密码错误2种情况 这里是密码错误的情况
				loginBean.setPas("111122");
				JUserCallService.loginAuth(loginBean);
				Thread.sleep(1100);
			}
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");
			// 等1分钟 解开
			Thread.sleep(60000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			// 执行2次 触发第二个风控
			for (int i = 0; i <= 3; i++) {
				urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
				urb.setClientIp(ip);
				uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
				uid = uc.getUserid();

				LoginAuthBean loginBean = JUserCallService.initLoginAuthBean(urb);
				loginBean.setLoginId(urb.getLoginId());
				loginBean.setDeviceId(urb.getDeviceId());
				loginBean.setClientIp(urb.getClientIp());
				// 密码正确和密码错误2种情况 这里是密码错误的情况
				loginBean.setPas("111122");
				JUserCallService.loginAuth(loginBean);
				Thread.sleep(1100);
			}

			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyRiskStrategy_050() {
		Logger.start(true, "BuyerIpBlacklistVerifyStrategy开启status2多级规则,密码正确触发买家ip黑名单列表风控JIRACONN-13509");
		// sit
		// loginSuccessConfig=1-10-1,2-16-2
		// loginFailConfig=1-5-1,2-8-2
		try {
			Logger.comment("前置条件准备");
			initConfig(1);
			userSafeWapper.updateRiskStrategyStatus(2, "BuyerIpBlacklistVerifyStrategy");
			String ip = TestDataManager.getRandomIp();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setClientIp(ip);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();
			// 执行11次 触发第一个风控
			for (int i = 0; i <= 10; i++) {
				urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
				urb.setClientIp(ip);
				uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
				uid = uc.getUserid();

				LoginAuthBean loginBean = JUserCallService.initLoginAuthBean(urb);
				loginBean.setLoginId(urb.getLoginId());
				loginBean.setDeviceId(urb.getDeviceId());
				loginBean.setClientIp(urb.getClientIp());
				JUserCallService.loginAuth(loginBean);
				Thread.sleep(1100);
			}
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");
			// 等1分钟 解开
			Thread.sleep(60000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			// 执行2次 触发第二个风控
			for (int i = 0; i <= 6; i++) {
				urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
				urb.setClientIp(ip);
				uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
				uid = uc.getUserid();

				LoginAuthBean loginBean = JUserCallService.initLoginAuthBean(urb);
				loginBean.setLoginId(urb.getLoginId());
				loginBean.setDeviceId(urb.getDeviceId());
				loginBean.setClientIp(urb.getClientIp());
				JUserCallService.loginAuth(loginBean);
				Thread.sleep(1100);
			}

			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}